package com.fisherman.test;

import com.fisherman.config.MainConfigOfLifeCycle;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @User: fisherman
 * @Date: 2020/5/20 11:20
 */
public class IOCTest_LifeCycle {

    @Test
    public void test(){
        //1.创建ioc容器
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfLifeCycle.class);
        System.out.println("容器创建完成。。。");

        //多实例bean在获取的时候才会创建bean
        applicationContext.getBean("car");

        //关闭容器
        applicationContext.close();
    }
}
